#coding:utf8
import pickle


def pos_features(feature_extraction_method,pos_filename):
    pos_review = pickle.load(open(pos_filename,'rb'))
    posFeatures = []
    for i in pos_review:
        posWords = [feature_extraction_method(i),'pos'] #为积极文本赋予"pos"（一条评论特征提取）
        posFeatures.append(posWords)
    return posFeatures

def neg_features(feature_extraction_method,neg_filename):
    neg_review = pickle.load(open(neg_filename,'rb'))
    negFeatures = []
    for j in neg_review:
        negWords = [feature_extraction_method(j),'neg'] #为消极文本赋予"neg"
        negFeatures.append(negWords)
    return negFeatures

